package com.roy.minimq.common.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class RemotingUtil {
    private static final Logger logger  = LoggerFactory.getLogger(RemotingUtil.class);
    public static String getLocalAddress(){
        final InetAddress localHost;
        try {
            localHost = InetAddress.getLocalHost();
            return localHost.getHostAddress();
        } catch (UnknownHostException e) {
            logger.error("Failed to obtain local address", e);
        }
        return null;
    }
}
